package com.wdh.kjs.activity;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.wdh.kjs.R;
import com.wdh.kjs.util.ToastUtils;

/**
 * Created by CQH on 2016/4/21.
 */
public class GesturesPasswordActivity extends BaseTopActivity implements View.OnClickListener{
    private Button bt_gesture_password;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gesturespassword_2);
        initTopBar("手势密码");
        initview();
//      setContentView(R.layout.gesturespassword);
//        LinearLayout a = (LinearLayout)findViewById(R.id.circle);
//        a.addView(new GesturesPassword(this));
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.bt_gesture_password:
                ToastUtils.showShort(GesturesPasswordActivity.this,"此功能尚未开放，敬请期待！");
                break;
            default:
                break;
        }
    }

    public class GesturesPassword extends View{

        public GesturesPassword(Context context) {
            super(context);
        }

        @Override
        protected void onDraw(Canvas canvas){
            super.onDraw(canvas);
            canvas.drawColor(Color.WHITE);
            Paint paint = new Paint();
            paint.setAntiAlias(true);
            paint.setStrokeWidth(3);
            paint.setStyle(Paint.Style.STROKE);
//            paint.setColor(Color.BLUE);
//            canvas.drawCircle(50,50,30,paint);
//            paint.setColor(Color.YELLOW);
//            canvas.drawCircle(100,50,30,paint);
//            paint.setColor(Color.BLACK);
//            canvas.drawCircle(150,50,30,paint);
//            paint.setColor(Color.GREEN);
//            canvas.drawCircle(75,90,30,paint);
//            paint.setColor(Color.RED);
//            canvas.drawCircle(125,90,30,paint);

            paint.setColor(Color.GRAY);
            canvas.drawCircle(160,250,70,paint);
            paint.setColor(Color.GRAY);
            canvas.drawCircle(360,250,70,paint);
            paint.setColor(Color.GRAY);
            canvas.drawCircle(560,250,70,paint);

            paint.setColor(Color.GRAY);
            canvas.drawCircle(160,450,70,paint);
            paint.setColor(Color.GRAY);
            canvas.drawCircle(360,450,70,paint);
            paint.setColor(Color.GRAY);
            canvas.drawCircle(560,450,70,paint);

            paint.setColor(Color.GRAY);
            canvas.drawCircle(160,650,70,paint);
            paint.setColor(Color.GRAY);
            canvas.drawCircle(360,650,70,paint);
            paint.setColor(Color.GRAY);
            canvas.drawCircle(560,650,70,paint);
        }
    }

    private void initview() {
        bt_gesture_password = (Button)findViewById(R.id.bt_gesture_password);
        bt_gesture_password.setOnClickListener(this);
    }

}
